#ifndef _CONNECTOR_H_
#define _CONNECTOR_H_

enum {
	CON_LOW, 
	CON_HIGH
	};

enum {
	CON_IO_TRANSPARENT,
	//CON_IO_BIT,
	CON_IO_BIT_IN,
	CON_IO_BIT_OUT
};

enum {
	CON_CLK_TRANSPARENT,
	CON_CLK_BIT_LOW,
	CON_CLK_BIT_HIGH
};

typedef struct connector_tag connector_t;

typedef struct ConMethodTag{
	uint8_t (*checkPresent)(connector_t* con, uint8_t num);
	uint8_t (*setVCC)(connector_t *con, uint8_t voltage);
	void (*setReset)(connector_t* con, uint8_t state);
	void (*switchTo)(connector_t* con, uint8_t num);
	uint8_t (*configClock)(connector_t* con, uint8_t conf);
	void (*setClock)(connector_t* con, uint8_t state);
	uint8_t (*configIO)(connector_t* con, uint8_t conf);
	void (*setIO)(connector_t* con, uint8_t state);
	uint8_t (*getIO)(connector_t* con);
	uint8_t (*getIn)(connector_t* con);
	void (*setC4)(connector_t* con, uint8_t state);
	void(*setC8)(connector_t* con, uint8_t state);
}ConMethod;

struct connector_tag
{
	uint8_t current_port;
	const ConMethod* method;
};


connector_t* Connector_Get(uint8_t num);
uint8_t Connector_CheckCardPresent(connector_t *con, uint8_t slot_num);
uint8_t Connector_PowerUp(connector_t *con, uint8_t voltage);
void Connector_PowerDown(connector_t *con);
void Connector_Init(void);
uint8_t Connector_SetVCC(connector_t *con, uint8_t voltage);
void Connector_SetResetState(connector_t *con, uint8_t state);
void Connector_Switch(connector_t *con, uint8_t num);
void Connector_ClockActive(connector_t *con);
void Connector_ClockDeactive(connector_t *con);

uint8_t Connector_ConfigClock(connector_t *con, uint8_t conf);
uint8_t Connector_SetClockState(connector_t *con, uint8_t state);
uint8_t Connector_SetIOState(connector_t *con, uint8_t state);
uint8_t Connector_GetIOState(connector_t *con, uint8_t *state);
uint8_t Connector_GetInState(connector_t *con);

uint8_t Connector_ConfigIO(connector_t *con, uint8_t conf);

uint8_t Connector_SetC4State(connector_t *con, uint8_t state);
uint8_t Connector_SetC8State(connector_t *con, uint8_t state);


#endif

